package com.report.dto.response;

import cn.zhxu.bs.bean.DbField;
import cn.zhxu.bs.bean.DbIgnore;
import cn.zhxu.bs.bean.SearchBean;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author summer
 * @date 2024-06-29 18:52
 **/
@Data
@SearchBean(tables = " research_member m LEFT JOIN member_rule r ON m.rule_id=r.id" ,autoMapTo = "m",orderBy = "m.login_time DESC")
public class MemberRes implements Serializable {

    @DbField("m.id")
    private Integer id;

    @DbField("m.nickName")
    private String nickName;

    @DbField("m.login_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime loginTime;

    @DbField
    private String phone;

    @DbField("m.createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;

    @DbField("m.is_wx")
    private Integer isWx;
    @DbField(" CASE WHEN m.is_wx=0 THEN '否' ELSE '是' END")
    private String wxName;

    @DbField("m.openId")
    private String openId;

    @DbField("m.member_state")
    private Integer memberState;

    @DbField("r.name")
    private String memberName;

    @DbField("m.rule_id")
    private Integer ruleId;

    @DbField("m.idNum")
    private String idNum;

    //月下载
    @DbField("r.downloadMonth")
    private Integer downloadMonth;

    //日下载
    @DbField("r.downloadDay")
    private Integer downloadDay;

    @DbField("r.readMonth")
    private Integer readMonth;

    @DbField("r.readDay")
    private Integer readDay;



    /**
     * 会员的有效时间
     */
    @DbField("m.effective_time")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date effectiveTime;

    @DbIgnore
    private String ticket;

    @DbField("m.avatarUrl")
    private String avatarUrl;

    @DbField("m.unionId")
    private String unionId;

    @DbField("m.mini_openId")
    private String miniOpenId;
}
